package com.zx.AnimationThread;

import java.util.ArrayList;
import java.util.Random;


import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Log;

import com.zx.tools.Tools;

public class PetalSet {
	
	ArrayList<Petal> petalSet;
	
	public PetalSet() {
		petalSet = new ArrayList<Petal>();
	}
	
	public void add(int count, double startTime,Resources res) {
		
		for(int i = 0; i < count; i ++) {
			Random ran = new Random();
			Bitmap tempImage = BitmapFactory.decodeResource(res, getImageId());
			Log.i("2", "tempImage = " + tempImage);
			Log.i("2", "Resources = " + res);
//			int tempX = (int)(0 + 480*(Math.random()));
//			int tempY = -15;
//			double tempv_v = 3 + 10*(Math.random());
//			double tempv_h = -12 + 10*(Math.random());
			int tempX = (int)(0 + 600*(Math.random()));
			int tempY = -15;
			int tempv_v = 3 + ran.nextInt(5);
			int tempv_h = -2 - ran.nextInt(6);
			Petal petal = new Petal(tempImage, tempX, tempY, tempv_v, tempv_h, startTime);
			petalSet.add(petal);
		}
	}
	
	
	public int getImageId() {
		Random ran = new Random();
		int ImageId = Tools.ImageArray[ran.nextInt(12)];
		return ImageId;
	}
}
